<?php
class Session {
	// Déclarations des données
	var $session = NULL;
	
	// Constructeur
	function Session(){
		$this->session = $_SESSION;
		
		if($this->getUser() == null){
			// feed options par défaut
			$this->session['feedoptions'] = array();
			$this->session['feedoptions']['status'] = "enable";
			$this->session['feedoptions']['ticket'] = "enable";
			$this->session['feedoptions']['relationship'] = "enable";
			$this->session['feedoptions']['news'] = "enable";
			
			$this->save();
		}
	}
	
	// Déclarations des méthodes
	function setUser($pUser){
		$this->session['user'] = $pUser;
		
		// chargement des feed options du user
		$this->session['feedoptions']['status'] = $pUser->getOption("displayStatusInFeed");
		$this->session['feedoptions']['ticket'] = $pUser->getOption("displayTicketInFeed");
		$this->session['feedoptions']['relationship'] = $pUser->getOption("displayRelationshipInFeed");
		$this->session['feedoptions']['news'] = $pUser->getOption("displayNewsInFeed");
		
		// sauvegarde de la session
		$this->save();
	}
	
	function getUser(){
		return $this->session['user'];
	}
	
	function setSwitchOption($pOptionName){
		
	}
	
	function save(){
		$_SESSION = $this->session;
	}
	
}